package com.wudimeng.syll.controller.api;


import com.wudimeng.syll.common.ApiResponse;
import com.wudimeng.syll.constants.Constant;
import com.wudimeng.syll.service.ICommonService;
import com.wudimeng.syll.service.IXingZhengQuYuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author laohei
 * @Date 2020/6/8 9:50
 * @Version 1.0
 */
@RestController
@Slf4j
@RequestMapping("syll")
public class CommonApiController {

    @Autowired
    private ICommonService service;

    @GetMapping("/ChinaCustoms")
    public ApiResponse getChinaCustoms(HttpServletRequest  request){
        try {
            return this.service.selectChinaCustoms();
        } catch (Exception e) {
            log.error("CommonApiController.ChinaCustoms.请稍后再试:" + e.getMessage());
            return ApiResponse.error(Constant.COMMON_PARAMETER_DEGRADE);
        }
    }


    @GetMapping("/Country")
    public ApiResponse getCountry(HttpServletRequest  request){
        try {
            return this.service.selectCountry();
        } catch (Exception e) {
            log.error("CommonApiController.getCountry.请稍后再试:" + e.getMessage());
            return ApiResponse.error(Constant.COMMON_PARAMETER_DEGRADE);
        }
    }


    @GetMapping("/EntryPort")
    public ApiResponse getEntryPort(HttpServletRequest  request){
        try {
            return this.service.selectEntryPort();
        } catch (Exception e) {
            log.error("CommonApiController.getEntryPort.请稍后再试:" + e.getMessage());
            return ApiResponse.error(Constant.COMMON_PARAMETER_DEGRADE);
        }
    }

}
